<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'leave.jsp' starting page</title>
		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/easyui/1.3.4/themes/default/easyui.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/wu.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/icon.css" />
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/1.3.4/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
		
		$(function(){
		$("form").submit(function(){
			var ordertime=$("input[name='ordertime']").val();
			var phone=$("input[name='phone']").val();
			var tel=$("input[name='tel']").val();
			var count=$("input[name='count']").val();
			var content=$("input[name='content']").val();
			var roleid=$("input[name='roleid']").val();
			if(ordertime==""||ordertime==null ){
				alert('请填写申请时间');
				return false;
			}
			if(phone==""||phone==null){
				alert('请填写手机号，');
				return false;
			}
			if(tel==""||tel==null){
				alert('请填写固定电话');
				return false;
			}
			
			if(count==""||count==null){
				alert('请填写数量');
				return false;
			}else if(count.length>=10){
				alert('超出填写范围');
				return false;
				}
  			if(content==""||content==null){
					alert('请填写备注');
					return false;
				}else if(content.length>=50){
					alert('超出填写范围');
					return false;
				}
			if(roleid==""||roleid==null){
				alert('请选择审批人');
				return false;
			}
				return true;	
	});
	});
		
		
		
			$(function(){
				var msg = $("#msg").val();
				if(msg!=""){
					$.messager.show({
						title:'消息',
						msg:msg
					});
					$("#msg").val("");
				}
				var deptid = $("#deptid").val();
				
				$("#pp").combobox({
				url:'${pageContext.request.contextPath}/user?op=Leader',
				valueField:'id',
				textField:'realname',
				panelHeight:'auto'
				});
				$("#pb").combobox({
				url:'${pageContext.request.contextPath}/dept?op=showRealName&id='+deptid,
				valueField:'id',
				textField:'realname',
				panelHeight:'auto'
				});
				
				
			});
		</script>
	</head>

	<body>
		<div style="margin: auto;width: 800px;height: 40px;">
			人事管理》请假申请
		</div>
		<form action="${pageContext.request.contextPath}/card?op=save" method="post">
		<div style="margin: auto; border-bottom: 1px solid black; border-top: 1px solid black; width: 800px;height: 400px">
			<table style="margin-top: 15px;margin-left: 20px;font-size: 12px">
				<input type="hidden" name="userid" value="${sys_user.id }"/>
				<input type="hidden" name="deptid" value="${sys_user.department.id }"/>
				<tr>
					<td style="width: 100px;height: 40px">姓名:</td>
					<td style="width: 150px">${sys_user.realname }</td>
					<td style="width: 100px">部门：</td>
					<td style="width: 150px">${sys_user.department.deptname }</td>
				</tr>
				<tr>
					<td style="width: 100px;height: 40px">申请时间:</td>
					<td style="width: 150px">
						<input class="easyui-datebox" style="width: 150px" name="ordertime">
					</td>
					<td style="width: 100px">职位：</td>
					<td style="width: 150px">
						${sys_user.role.rolename }
					</td>
				</tr>
				
				<tr>
					<td style="width: 100px;height: 40px">手机号:</td>
					<td style="width: 150px">
						<input type="text" name="phone">
					</td>
					<td style="width: 100px">座机号：</td>
					<td style="width: 150px">
						<input type="text" id="type" name="tel">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;height: 40px">数量:</td>
					<td style="width: 150px">
						<input type="text" name="count">
					</td>
					<td style="width: 100px"></td>
					<td style="width: 150px">
						
					</td>
				</tr>
				<tr>
					<td style="width: 100px">备注:</td>
					<td style="width: 150px" colspan="3">
						<textarea rows="8px" cols="80px" name="content"></textarea>
					</td>
					
				</tr>
				
			</table>
		</div>

		<div style="margin: auto;width: 800px;height: 40px; margin-top:15px;">
			<table style="margin-left: 50px">
				<tr>
					<td style="width: 150px">下一步审批人:</td>
					<td style="width: 150px">
					<c:if test="${sys_user.role.id==5 }">
						<input type="text" id="pb" name="roleid"/>
						<input type="hidden" id="deptid" value="${sys_user.department.id }"/>
						
					</c:if>
					<c:if test="${sys_user.role.id==3 }">
						<input type="text" id="pp" name="roleid"/>
					</c:if>
						
					</td>
					<td style="width: 200px"></td>
					<td style="width: 100px">
						<input type="submit" value="确定">
					</td>
					<td style="width: 100px">
						<input type="submit" value="取消">
					</td>
				</tr>
			</table>
		</div>
		</form>
		<input type="hidden" id="msg" value="${msg }">
	</body>
</html>
